<?php $this->load->view('Admin/navbar');?>
<!-- Tab panes -->
<div class="tab-content" style="margin-top: 10px;">
	<div role="tabpanel" class="tab-pane" id="<?=$focusTag?>">

		<div class="panel panel-default">
		  <!-- Default panel contents -->
		  <div class="panel-heading">同步选择项</div>
		  <div class="panel-body">
		    <p>
			    此程序用在同步出现延迟或者BTL数据出现异常时要用到，通过此程序可以重建扫描BTL接口数据写入到RMP系统中。<br>
			    正常定时任务只会同步待同步的数据，此程序可以选择已同步过的数据再次同步，防止特殊情况出现。<br>
			    <font color="red">同步顺序：先同步项目，再同步线上广宣或线下活动，否则广宣或线下活动可能找不到匹配的项目无法同步部分数据。</font>
		    </p>
				  <div class="col-sm-7 col-md-offset-3">
				  	<form class="form-horizontal" name="add" id="add" action="<?php echo $this->input->server('REQUEST_URI'); ?>" method="post">
				  		<!-- <div class="form-group">
				  								    <label for="dataType" class="col-sm-2 control-label">数据类型：</label>
				  								    <div class="col-sm-4">
				  								    	<select required class="form-control" id="dataType" name="dataType">
				  									      <option value="">请选择</option>
				  									      <?php foreach ($dataTypeCon as $k => $v) {?>
				  									      <option value="<?=$k?>" <?=$k==$where['dataType'] ? 'selected' :''?>><?=$v?></option>
				  									      <?php } ?>
				  										</select>
				  								    </div>
				  								 </div> -->
				  		<div class="form-group">
						    <label for="year" class="col-sm-2 control-label">年份：</label>
						    <div class="col-sm-4">
						    	<select required class="form-control" id="year" name="year">
							      <option value="">请选择</option>
								</select>
						    </div>
						 </div>
						 <div class="form-group">
						    <label for="month" class="col-sm-2 control-label">月份：</label>
						    <div class="col-sm-4">
						    	<select required class="form-control" id="month" name="month">
							      <option value="">请选择</option>
							      <?php for($i=1;$i<=date("m");$i++){ ?>
							      <option value="<?=$i?>" <?=$i==$where['month'] ? 'selected' :''?>><?=$i?>月</option>
							      <?php } ?>
								</select>
						    </div>
						 </div>
						 <!-- <div class="form-group">
						    <label for="updateNum" class="col-sm-2 control-label">同步数：</label>
						    <div class="col-sm-4">
						    	<input type="number" required min="1" max="40" class="form-control" value="<?=$where['updateNum']?>" id="updateNum" name="updateNum" placeholder="同步数">
						    </div>
						 </div>
						 <div class="form-group">
						    <label for="updatePage" class="col-sm-2 control-label">页码：</label>
						    <div class="col-sm-4">
						    	<input type="number" required min="1" class="form-control" value="<?=$where['updatePage']?>" id="updatePage" name="updatePage" placeholder="同步页码">
						    </div>
						 </div> -->
						 <div class="form-group">
						    <label for="state" class="col-sm-2 control-label">数据状态：</label>
						    <div class="col-sm-4">
								<label class="radio-inline">
								  <input required type="radio" <?=$where['state'] == 0 ? 'checked' : ''?> name="state" id="state1" value="0"> 待同步
								</label>
								<label class="radio-inline">
								  <input required type="radio" <?=$where['state'] == 1 ? 'checked' : ''?> name="state" id="state2" value="1"> 已同步
								</label>
						    </div>
						 </div>
						 <div class="form-group text-center">
						 	<button type="submit" class="btn btn-default btn-primary">同步</button>
						</div>
				  	</form>
				  </div>
				</div>

		  </div>
	</div>
</div>
<script type="text/javascript">
$(function(){
	loadYearList('year',<?=$where['year'] ? $where['year'] : 0?>);
	initValidation();
});
	//初始化验证
function initValidation(){
	$('form[name="add"]').find("input,select,textarea").jqBootstrapValidation("destroy");
	$('form[name="add"]').find("input,select,textarea").not("[type=submit]").jqBootstrapValidation({
	    preventSubmit:false,
	    submitSuccess: function (form, event) {
	         event.preventDefault();
	         newWindow("执行情况",'<?php echo $this->input->server('REQUEST_URI'); ?>&runing=1&dataType='+$("#dataType").val()+'&year='+$("#year").val()+'&month='+$("#month").val()+"&updateNum="+$("#updateNum").val()+"&updatePage="+$("#updatePage").val()+"&state="+$("#state").val(), 600, 500);
	         //ajaxFormSubmit('add');
	     },
	     submitError: function (form, event, errors) {
	       event.preventDefault();
	       }
  	});
}
</script>
<?php $this->load->view('Admin/foot');?>